Information
Revision
is a framework for revision-tolerant serialization and deserialization with support for schema evolution over time. It allows for easy revisioning of structs and enums for data storage requirements which need to support backwards compatibility, but where the design of the data structures evolve over time. Revision enables data that was serialized at older revisions to be seamlessly deserialized and converted into the latest data structures. It uses bincode for serialization and deserialization.
The Revisioned
trait is automatically implemented for the following primitives: u8
, u16
, u32
, u64
, u128
, usize
, i8
, i16
, i32
, i64
, i128
, isize
, f32
, f64
, char
, String
, Vec<T>
, Arrays up to 32 elements, Option<T>
, Box<T>
, Bound<T>
, Wrapping<T>
, Reverse<T>
, (A, B)
, (A, B, C)
, (A, B, C, D)
, (A, B, C, D, E)
, Duration
, HashMap<K, V>
, BTreeMap<K, V>
, HashSet<T>
, BTreeSet<T>
, BinaryHeap<T>
, Result<T, E>
, Cow<'_, T>
, Decimal
, regex::Regex
, uuid::Uuid
, chrono::DateTime<Utc>
, geo::Point
, geo::LineString
geo::Polygon
, geo::MultiPoint
, geo::MultiLineString
, geo::MultiPolygon
, and ordered_float::NotNan
.
Inspiration
This code takes inspiration from the Versionize library developed for Amazon Firecracker snapshot-restore development previews.
Revision in action
use Error;
use revisioned;
// The test structure is at revision 3.
// The test structure is at revision 3.